﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using QLTV_Public;

namespace QLTV_Data
{
   public class ViPham_Data
    {
       KetNoiCSDL_Data kn = new KetNoiCSDL_Data();
       public DataTable LayDuLieu()
       {
           return kn.LayDuLieu("Load_tbl_ViPham");
       }
       public int insert_ViPham(ViPham_Public maDocGia,ViPham_Public lydo,ViPham_Public hinhThuc,ViPham_Public ngayXuLy,ViPham_Public nguoiXuLy)
       {
           int n = 5;
           string[] name = new string[n];
           object[] value = new object[n];
           name[0] = "@MaDocGia";
           value[0] = maDocGia.MaDocGia;
           name[1] = "@LyDoViPham";
           value[1] = lydo.LyDoViPham;
           name[2] = "@HinhThuc";
           value[2] = hinhThuc.HinhThuc;
           name[3] = "@NgayXuLy";
           value[3] = ngayXuLy.NgayXuLy;
           name[4] = "@NguoiXuLy";
           value[4] = nguoiXuLy.NguoiXuLy;
           return kn.update("Insert_ViPham",name,value,n);
       }
       public int Update_ViPham(ViPham_Public maViPham,ViPham_Public maDocGia, ViPham_Public lydo, ViPham_Public hinhThuc, ViPham_Public ngayXuLy, ViPham_Public nguoiXuLy)
       {
           int n = 6;
           string[] name = new string[n];
           object[] value = new object[n];
           name[0] = "@MaViPham";
           value[0] = maViPham.MaViPham;
           name[1] = "@MaDocGia";
           value[1] = maDocGia.MaDocGia;
           name[2] = "@LyDoViPham";
           value[2] = lydo.LyDoViPham;
           name[3] = "@HinhThuc";
           value[3] = hinhThuc.HinhThuc;
           name[4] = "@NgayXuLy";
           value[4] = ngayXuLy.NgayXuLy;
           name[5] = "@NguoiXuLy";
           value[5] = nguoiXuLy.NguoiXuLy;
           return kn.update("Update_ViPham", name, value, n);
       }
       public int Delete_ViPham(ViPham_Public maViPham)
       {
           int n = 1;
           string[] name = new string[n];
           object[] value = new object[n];
           name[0] = "@MaViPham";
           value[0] = maViPham.MaViPham;
           return kn.update("Delete_ViPham", name, value, n);
       }
    }
}
